{% extends 'TopxiaWebBundle::layout.html.twig' %}

{% block title %}{% if type == 'normal' %}{{'创建课程'|trans}}{% else %}{{'创建直播课程'|trans}}{% endif %} - {{ parent() }}{% endblock %}

{% set script_controller = 'course/create' %}

{% block content %}
<div class="row">
  <div class="col-md-offset-2 col-md-8">
    <div class="panel panel-default panel-page">
      <div class="panel-heading"><h2>{% if type == 'normal' %}{{'创建课程'|trans}}{% else %}{{'创建直播课程'|trans}}{% endif %}</h2></div>

      {% if not app.user.largeAvatar or not app.user.title or not userProfile.about %}
        {% include 'TopxiaWebBundle:Settings:user-profile.html.twig'%}
      {% else %}
        <form id="course-create-form" class="form-horizontal" method="post">

          {{ web_macro.flash_messages() }}

          <div class="form-group">
            <div class="col-md-2 control-label"><label for="course_title" class="required">{{'标题'|trans}}</label></div>
            <div class="col-md-8 controls">
              <input type="text" id="course_title" name="title" required="required" class="form-control" data-widget-cid="widget-1" data-explain="">
              <div class="help-block" style="display:none;"></div>
            </div>
          </div> 

          {% include 'OrgBundle:Org:org-tree-select.html.twig' %}

      <div class="form-group">
        <label class="col-md-2 control-label">{{'课程购买'|trans}}</label>
          <div class="col-md-8 controls radios">
            {{ radios('buyable', {'1':'开启'|trans, '0':'关闭'|trans}, course.buyable|default(1) ) }}
           <div class="help-block">{{'关闭后课程将无法在线购买加入、由教师/管理员后台导入。'|trans}}</div>
        </div>
      </div>

          <div class="form-group">
            <div class="col-md-offset-2 col-md-8 controls">
              <input id="course-create-btn" data-submiting-text="{{'正在创建'|trans}}" class="btn btn-fat btn-primary" type="submit" value="{{'创建'|trans}}">
            </div>
          </div>

          {% if not setting('copyright.owned') %}
          <div class="form-group">
            <div class="col-md-offset-2 col-md-8 controls">
              <p class="mtl"><a href="http://www.qiqiuyu.com/course/22" class="text-muted" target="_blank">{{'如何创建课程？'|trans}}</a></p>
            </div>
          </div>
          {% endif %}

          <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
          <input type="hidden" name="type" value="{{ type }}">

        </form>

      {% endif %}
    </div>

  </div>

</div>
{% endblock %}